<script src="./script.js"></script>
<style src="./style.css"></style>
<template>
  <div class="app-container">
    <div class="filter-container">
      <div>
        <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="exportData">导出数据</el-button>
      </div>
    </div>

    <el-table
      :key="tableKey"
      v-loading="listLoading"
      :data="list"
      border
      fit
      highlight-current-row
      :show-summary="statistics != null"
      :summary-method="getSummaries"
      style="width: 100%;"
    >
      <el-table-column label="分类" width="160">
        <template slot-scope="{row}">
          <div><el-link type="primary">{{ row.parent_category_name }}></el-link><el-link type="danger">{{ row.category_name }}</el-link></div>
        </template>
      </el-table-column>

      <el-table-column label="名称">
        <template slot-scope="{row}">
          {{ row.product_name }}
        </template>
      </el-table-column>

      <el-table-column label="规格" width="160">
        <template slot-scope="{row}">
          {{ row.product_item_name }}
        </template>
      </el-table-column>

      <el-table-column label="库存单价" width="120px">
        <template slot-scope="{row}">
          {{ row.price }}
        </template>
      </el-table-column>

      <el-table-column label="数量" width="120px">
        <template slot-scope="{row}">
          {{ row.quantity }}
        </template>
      </el-table-column>

      <el-table-column label="小计" width="120px">
        <template slot-scope="{row}">
          {{ row.subtotal }}
        </template>
      </el-table-column>

    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />

  </div>
</template>
